﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartWMS.Common.ResponseOutput;
using SmartWMS.Domain.FinanceManage;
using SmartWMS.EntityFramework;
using SmartWMS.Server.FinanceManage.ReceivablesServices;
using SmartWMS.Server.FinanceManage.ReceivablesServices.Dto;
using SmartWMS.Server.Repository;

namespace SmartWMS.API.Controllers.FinanceManage
{
    /// <summary>
    /// 应收管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ReceivablesController : ControllerBase
    {
        private readonly IReceivablesServices _receivablesServices;

        public ReceivablesController(IReceivablesServices receivablesServices)
        {
            _receivablesServices = receivablesServices;
        }
        /// <summary>
        /// 财务应收信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<List<CollectionDto>>> GetCustomList(Selcollection input)
        {
            return _receivablesServices.GetCustomList(input);
        }
        /// <summary>
        /// 财务类别下拉框
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<List<PayType>>> GetCustom()
        {
            return _receivablesServices.GetCustom();
        }
        /// <summary>
        /// 应收金额信息添加
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> AddCollection(Collection info)
        {
            return _receivablesServices.AddCollection(info);
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns> 
        [HttpPost]
        public Task<Response<bool>> BatchDelSuppiler(CollectionDto info)
        {
            return _receivablesServices.BatchDelSuppiler(info);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> DelSuppiler(CollectionDto info)
        {
            return _receivablesServices.DelSuppiler(info);
        }
        /// <summary>
        /// 反填应收金额信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns> 
        [HttpPost]
        public Task<Response<CollectionDto>> GetSupplierById(CollectionDto info)
        {
            return _receivablesServices.GetSupplierById(info);
        }
        /// <summary>
        /// 修改应收金额信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns> 
        [HttpPost]
        public Task<Response<bool>> UpdateSuppiler(CollectionDto info)
        {
            return _receivablesServices.UpdateSuppiler(info);
        }
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> Updatestate(CollectionDto info)
        {
            return _receivablesServices.Updatestate(info);
        }
        /// <summary>
        /// 付款
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> Updpayment(CollectionDto info)
        {
            return _receivablesServices.Updpayment(info);
        }
    }
}
